<?php 
if($this_is_home_page){
	//
	$top_search_sql="SELECT cd.categories_id,ck.keyword
	                 FROM `".TABLE_CATEGRIES_KEYWROD."` ck, `".TABLE_CATEGORIES_DESCRIPTION."` cd 
					 WHERE ck.categories_id = cd.categories_id 
					       and `categories_name`='index'
					       and language_id = '" . $_SESSION['languages_id'] . "'";
}else{
	$top_search_sql="SELECT ck.keyword
	                 FROM `".TABLE_CATEGRIES_KEYWROD."` ck
					 WHERE ck.categories_id = '".(int)$current_category_id."'"  ;		
}
$top_search = $db->Execute($top_search_sql);


$i=1;
if($this_is_home_page){
?>

<div><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'comm_topsearches_top.gif'); ?></div>
<div class="top-search"><div class="top-search-tle">Top Searches</div>
<div>
<?php 
while (!$top_search->EOF) {
	$keyword=str_replace(' ','+',$top_search->fields['keyword']);
	$keyword=strip_tags($keyword);
	echo '<a class="top-search-n" href="'.zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT,'search_in_description=1', $request_type, false).'&keyword='.$keyword.'">'. $top_search->fields['keyword'].'</a>';
	if($i%9==0){ echo '<br />';}
	$i++;
	$top_search->MoveNext();
}
?>

</div>
</div>
<div><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'comm_topsearches_bottom.gif'); ?></div>

<?php 
}else{
?>


<table width="778" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td width="778">
<?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'tsearch.gif'); ?></td></tr>

<tr><td class="catTsBox"><table width="754" cellspacing="0" cellpadding="0" border="0"><tbody>
<?php 
while (!$top_search->EOF) {
	$keyword=str_replace(' ','+',$top_search->fields['keyword']);
	$keyword=strip_tags($keyword);
	
	if($i%4==1){ echo '<tr>';}
	echo '<td width="25%" valign="top">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tbody>
            <tr>
                <td width="11" valign="top">'.zen_image(DIR_WS_TEMPLATE_IMAGES . 'TopSearch_bullet.gif').'</td>
                <td valign="top" style="padding-left: 6px; padding-right: 6px;"><a  class="catTsLink" href="'.zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT,'search_in_description=1', $request_type, false).'&keyword='.$keyword.'">'. $top_search->fields['keyword'].'</a>       </td>
            </tr>
        </tbody>
    </table>
</td>';

	$top_search->MoveNext();
	if($top_search->EOF and ($i%4!=0)){
		echo '</tr>';
	}
	if($i%4==0){ echo '</tr>';}
	$i++;
}
?>

</tbody></table></td></tr><tr><td valign="bottom"><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'comm_bottom.gif'); ?></td></tr></tbody></table>
<?php }?>



         